﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UM_SERVER.Packet
{
    public abstract class InPackage : Package
    {
        /// <summary>
        ///     验证包
        /// </summary>
        /// <returns>
        ///     默认返回true
        /// </returns>
        public override bool ValidataPackage()
        {
            return true;
        }

        /// <summary>
        ///     得到包名
        /// </summary>
        /// <returns>
        ///     默认返回未知包名
        /// </returns>
        public override string GetPackageName()
        {
            return "UnKownPackage";
        }

        /// <summary>
        ///     得到包体
        /// </summary>
        /// <returns>
        ///     返回包体
        /// </returns>
        public override Dictionary<String, byte[]> GetBody()
        {
            return this.Body;
        }

        /// <summary>
        ///      得到当前基础会话码
        /// </summary>
        /// <returns>返回基础会话码</returns>
        public String GetSessionCode()
        {
            try
            {
                return Encoding.Default.GetString(this.Body["SESSIONCODE"]).Replace("*@^@*", "");
            }
            catch(Exception ex)
            {
                return null;
            }
        }

        /// <summary>
        ///     初始化包数据
        /// </summary>
        public abstract void InitPackage();

        public override byte[] EncryptBody()
        {
            throw new NotImplementedException();
        }

        public override byte[] DecryptBody()
        {
            throw new NotImplementedException();
        }

        public override Protocol.NetworkProtocol GetProtocol()
        {
            throw new NotImplementedException();
        }

        public override string GetHashCode()
        {
            throw new NotImplementedException();
        }

        public override int GetcryptograshStart()
        {
            throw new NotImplementedException();
        }
    }
}                                                                                                                                                                                                                                                                                                                                                